/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.manager.editar;

import br.com.deployment.entidade.fermojupi.AtoCampo;
import br.com.deployment.servico.AtoCampoServico;
import java.io.IOException;
import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

/**
 *
 * @author luciano
 */
@ManagedBean
@SessionScoped
public class ManagerEditarAtoCampo implements Serializable{

    @EJB
    AtoCampoServico atoCampoService;
    
    private AtoCampo atoCampo;   

    public ManagerEditarAtoCampo() {
    }

    public void editar() {
        atoCampoService.atualizar(atoCampo);
    }

    public AtoCampo getAtoCampo() {
        return atoCampo;
    }

    public void setAtoCampo(AtoCampo atoCampo) {
        this.atoCampo = atoCampo;
    }

    public void redirect(String string, AtoCampo atoC) {
        try {
            FacesContext context = FacesContext.getCurrentInstance();
            atoCampo = atoC;
            context.getExternalContext().redirect(string);
        } catch (IOException ex) {
            Logger.getLogger(ManagerEditarAtoCampo.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
     public void redirect(String string) {
        try {
            FacesContext context = FacesContext.getCurrentInstance(); 
            context.getExternalContext().redirect(string);
        } catch (IOException ex) {
            Logger.getLogger(ManagerEditarAtoCampo.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
}
